package com.me.modules.aff.service.impl;

import com.me.modules.common.common.Constant;
import com.me.modules.common.page.Page;
import com.me.modules.common.page.PageHelper;
import com.me.modules.common.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.me.modules.aff.dao.AffairsInfoDao;
import com.me.modules.aff.entity.AffairsInfoEntity;
import com.me.modules.aff.service.AffairsInfoService;



@Service("affairsInfoService")
public class AffairsInfoServiceImpl implements AffairsInfoService {
	@Autowired
	private AffairsInfoDao affairsInfoDao;

	@Override
	public AffairsInfoEntity queryObject(Long id){
		return affairsInfoDao.queryObject(id);
	}

	@Override
	public List<AffairsInfoEntity> queryList(Map<String, Object> map){
		return affairsInfoDao.queryList(map);
	}

    @Override
    public List<AffairsInfoEntity> queryListByBean(AffairsInfoEntity entity) {
        return affairsInfoDao.queryListByBean(entity);
    }

	@Override
	public int queryTotal(Map<String, Object> map){
		return affairsInfoDao.queryTotal(map);
	}

	@Override
	public int save(AffairsInfoEntity affairsInfo){
		affairsInfo.setStatus("1");
		affairsInfo.setStartTime(new Date());
		affairsInfo.setReqId(UserUtils.getCurrentUserId());
		return affairsInfoDao.save(affairsInfo);
	}

	@Override
	public int update(AffairsInfoEntity affairsInfo){
        return affairsInfoDao.update(affairsInfo);
	}

	@Override
	public int delete(Long id){
        return affairsInfoDao.delete(id);
	}

	@Override
	public int deleteBatch(Long[] ids){
        return affairsInfoDao.deleteBatch(ids);
	}
	@Override
	public Page<AffairsInfoEntity> findPage(AffairsInfoEntity affairsInfo, int pageNum) {
		PageHelper.startPage(pageNum, Constant.pageSize);
		affairsInfoDao.queryList(affairsInfo);
		return PageHelper.endPage();
	}
}
